webpackJsonp([6],{

/***/ "NDmX":
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__.p + "static/img/avatar.163575a.png";

/***/ }),

/***/ "lIeB":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__("KH7x");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/config/index.js
var config = __webpack_require__("2uFj");

// EXTERNAL MODULE: ./src/store/index.js
var store = __webpack_require__("IcnI");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// EXTERNAL MODULE: ./src/common/plugin/utils/bridge.js
var bridge = __webpack_require__("4Bcj");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/apps/home/index.vue





//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//







var TABS = {
  public: '外网IP',
  private: '内网IP',
  local: '本地IP'
};
/* harmony default export */ var home = ({
  name: 'page-home',
  data: function data() {
    var _this = this;

    return {
      TABS: TABS,
      more: false,
      leftData: [],
      rightData: [{
        font: 'yt-icon yt-icon-more',
        click: function click() {
          _this.more = !_this.more;
        }
      }],
      page: 0,
      slider: 0,
      sliders: [{
        img: __webpack_require__("pDSL")
      }],
      grids: [],
      emergencyObj: null,
      todoObj: {},
      user: {},
      userRole: '',
      enterpriseId: ''
    };
  },
  mounted: function mounted() {},
  activated: function activated() {
    var _this2 = this;

    return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
      var grids, user;
      return regenerator_default.a.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              grids = [{
                font: 'iconfont icon-law',
                text: '行政执法',
                path: '/law'
              }, {
                font: 'iconfont icon-list',
                // badge: {value: 120},
                text: '待办事项',
                path: '/todo'
              }, {
                font: 'iconfont icon-company',
                text: '企业信息',
                path: '/company'
              }, {
                font: 'iconfont icon-check',
                text: '重大危险源',
                path: '/danger-source-check'
              }, {
                font: 'iconfont icon-data',
                text: '知识库',
                path: '/repository'
              }, {
                font: 'iconfont icon-machine',
                text: '应急救援',
                path: '/emergency'
              }, {
                font: 'iconfont icon-line',
                text: '统计分析',
                path: '/analysis'
              }, {
                font: 'iconfont icon-phone',
                text: '通讯联络',
                path: '/contact'
              },
              // {
              //   font: 'iconfont icon-author',
              //   text: '专家库',
              //   path: '/professional'
              // },
              // {
              //   font: 'iconfont icon-card',
              //   text: '人员工卡',
              //   path: '/work-card'
              // },
              {
                font: 'iconfont icon-contact',
                text: '二道门',
                path: '/twoDoor'
              }, {
                font: 'iconfont icon-machine-2',
                text: '特殊作业',
                path: '/special-work'
              }, {
                font: 'iconfont icon-danger',
                text: '隐患排查',
                path: '/dangerCheck'
              }, {
                font: 'iconfont icon-anquanzhenggaioff',
                text: '安全风险',
                path: '/security-risk'
              }];

              _this2.enterpriseId = Object(store["d" /* JudgeRole */])().administrator(function () {
                _this2.grids = grids;
                _this2.userRole = 'administrator';
              }).enterprise(function () {
                // 企业端登陆没有行政执法模块和统计分析模块
                _this2.grids = grids.filter(function (v) {
                  return v.text !== '行政执法' && v.text !== '统计分析';
                });
                _this2.userRole = 'enterprise';
                return (Object(store["c" /* GetStore */])(store["f" /* Store */].enterprise) || {}).id;
              }).government(function () {
                _this2.grids = grids;
                _this2.userRole = 'government';
              }).default(function () {
                _this2.grids = grids;
                _this2.userRole = '';
              });

              user = Object(store["c" /* GetStore */])(store["f" /* Store */].user);
              _context.next = 5;
              return commonApi["a" /* commonApi */].searchById('User', user.id);

            case 5:
              _this2.user = _context.sent;

              Object(store["e" /* SetStore */])(store["f" /* Store */].user, _this2.user);

              bridge["a" /* bridge */].pushBind({ userName: _this2.user.username, userId: _this2.user.id });
              console.log(_this2.user.username + _this2.user.id);

              _this2.initData();
              _this2.initTodoData();

            case 11:
            case 'end':
              return _context.stop();
          }
        }
      }, _callee, _this2);
    }))();
  },

  methods: {
    handler: function handler(key) {
      Object(store["e" /* SetStore */])(config["e" /* IP */], config["c" /* BaseUrl */][key]);
      this.more = !this.more;
    },
    goPage: function goPage(path) {
      //企业端登陆
      if (path === '/company' && this.enterpriseId) {
        this.$router.$push({
          path: '/company/detail',
          query: { id: this.enterpriseId }
        });
      } else if (path === '/special-work' && this.enterpriseId) {
        this.$router.$push({
          path: '/special-work/list',
          query: { req_departName: this.enterpriseId }
        });
      } else if (path === '/dangerCheck' && this.enterpriseId) {
        this.$router.$push({
          path: '/dangerCheck/list',
          query: { state: 1, enterprise_name: this.enterpriseId, supervise: 1 }
        });
      } else if (path === '/security-risk' && this.enterpriseId) {
        this.$router.$push({
          path: '/security-risk/list',
          query: { user: this.enterpriseId }
        });
      } else if (path === '/twoDoor' && this.enterpriseId) {
        this.$router.$push({
          path: '/twoDoor',
          query: { enterpriseId: this.enterpriseId }
        });
      } else {
        this.$router.$push(path);
      }
    },
    goTodoPage: function goTodoPage(item) {
      var TodoCategory = ['行政执法', '收发文件', '通知公告', '企业隐患排查', '特殊作业', '综合考评', '企业注册审核', '其他'];

      if (item.todo_category === '行政执法') {
        this.$router.$push('/law');
      } else if (item.todo_category === '收发文件' || item.todo_category === '通知公告' || item.todo_category === '会议通知') {
        this.$router.$push('/message');
      } else if (item.todo_category === '企业隐患排查') {
        this.$Toast('请登录pc端系统，及时处理！');
        this.$router.$push('/dangerCheck');
      } else if (item.todo_category === '特殊作业') {
        this.$router.$push('/special-work');
      } else if (item.todo_category === '企业注册审核') {
        this.$router.$push('/company/register');
      } else {
        // 其他类型暂不支持
      }
    },
    initData: function initData() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        var param, p, _ref, _ref2, accidentTypeDic, emergencyObj;

        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                param = _this3.enterpriseId ? {
                  equalTo: { enterpriseId: _this3.enterpriseId },
                  notEqualTo: { state: 2 }
                } : { notEqualTo: { state: 2 } };
                p = [commonApi["a" /* commonApi */].dictionary('Accident_type'), commonApi["a" /* commonApi */].searchFirst('yj_emergency_information', extends_default()({
                  include: ['enterprise_name']
                }, param))];
                _context2.next = 4;
                return promise_default.a.all(p);

              case 4:
                _ref = _context2.sent;
                _ref2 = slicedToArray_default()(_ref, 2);
                accidentTypeDic = _ref2[0];
                emergencyObj = _ref2[1];

                emergencyObj._accident_type = emergencyObj.accident_type;
                _this3.emergencyObj = Object(utils["d" /* ReplaceDictionary */])(emergencyObj, {
                  accident_type: accidentTypeDic
                });

              case 10:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this3);
      }))();
    },
    initTodoData: function initTodoData() {
      var _this4 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        var user, roles, options, todoCount;
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                user = Object(store["c" /* GetStore */])(store["f" /* Store */].user);
                roles = Object(store["c" /* GetStore */])(store["f" /* Store */].roles);
                options = {
                  and: [{
                    or: [{ containedIn: { todo_role: roles.map(function (v) {
                          return v.name;
                        }) } }, { containedIn: { todo_id: [user.id] } }]
                  }, {
                    notContainedIn: { todo_category: ['综合考评', '其他'] }
                  }, {
                    equalTo: { todo_state: 0 }
                  }]
                };
                _context3.next = 5;
                return commonApi["a" /* commonApi */].searchFirst('sys_todo', options);

              case 5:
                _this4.todoObj = _context3.sent;
                _context3.next = 8;
                return commonApi["a" /* commonApi */].searchCount('sys_todo', options);

              case 8:
                todoCount = _context3.sent;

                _this4.grids.map(function (v) {
                  if (v.text === '待办事项') {
                    return extends_default()({}, v, { badge: { value: todoCount } });
                  }
                });

              case 10:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this4);
      }))();
    },
    goEmergencyPage: function goEmergencyPage() {
      this.$router.$push({
        path: '/emergency/info',
        query: {
          id: this.emergencyObj.id,
          title: this.emergencyObj.enterprise_name.attributes.EnterpriseName || '应急救援'
        }
      });
    },
    logout: function logout() {
      commonApi["a" /* commonApi */].logout();
      var user = Object(store["c" /* GetStore */])(store["f" /* Store */].user);
      bridge["a" /* bridge */].pushUnBind({ userName: user.username, id: user.id });
      this.$router.$push({
        path: '/login'
      });
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-54312d87","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/apps/home/index.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"leftData":_vm.leftData,"more":_vm.more,"title":"智慧安监"},on:{"update:more":function($event){_vm.more=$event}}},[_c('ul',{staticClass:"ul",attrs:{"slot":"more"},slot:"more"},_vm._l((_vm.TABS),function(tab,key){return _c('li',{key:key,on:{"click":function($event){return _vm.handler(key)}}},[_vm._v(_vm._s(tab))])}),0),_vm._v(" "),_c('yt-tabbar',{attrs:{"slider":false},model:{value:(_vm.page),callback:function ($$v) {_vm.page=$$v},expression:"page"}},[_c('yt-tabbar-panel',{attrs:{"text":"首页","font":"iconfont icon-main"}},[_c('yt-slider',{staticClass:"slider",attrs:{"list":_vm.sliders,"dots":""},scopedSlots:_vm._u([{key:"default",fn:function(scope){return _c('div',{staticClass:"item"},[_c('img',{attrs:{"src":scope.data.img}})])}}]),model:{value:(_vm.slider),callback:function ($$v) {_vm.slider=$$v},expression:"slider"}}),_vm._v(" "),_c('div',{staticClass:"list"},[_c('div',{staticClass:"item yt-border-all",on:{"click":function($event){return _vm.goPage('/message')}}},[_c('div',{staticClass:"item-icon-left bg1"},[_c('i',{staticClass:"iconfont icon-message"})]),_vm._v(" "),_c('div',{staticClass:"content"},[_c('p',{staticClass:"title"},[_vm._v("通知公告")]),_vm._v(" "),_c('p',{staticClass:"des"},[_vm._v("请前往详情页查看更多公告！")])])]),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.todoObj),expression:"todoObj"}],staticClass:"item yt-border-all",on:{"click":function($event){return _vm.goTodoPage(_vm.todoObj)}}},[_c('div',{staticClass:"item-icon-left bg2"},[_c('i',{staticClass:"iconfont icon-list"})]),_vm._v(" "),_c('div',{staticClass:"content"},[_c('p',{staticClass:"title"},[_vm._v("待办事项"),_c('span',[_vm._v(_vm._s(_vm.todoObj ? _vm.todoObj.todo_time : ''))])]),_vm._v(" "),_c('p',{staticClass:"des"},[_vm._v(_vm._s(_vm.todoObj ? _vm.todoObj.todo_content : ''))])])]),_vm._v(" "),(_vm.emergencyObj)?_c('div',{staticClass:"item yt-border-all",on:{"click":_vm.goEmergencyPage}},[_c('div',{staticClass:"item-icon-left bg3"},[_c('i',{staticClass:"iconfont icon-danger"})]),_vm._v(" "),_c('div',{staticClass:"content"},[_c('p',{staticClass:"title"},[_vm._v("应急救援"),_c('span',[_vm._v(_vm._s(_vm._f("formatTime")(_vm.emergencyObj.updatedAt,'YYYY-MM-DD HH:mm:ss')))])]),_vm._v(" "),_c('p',{staticClass:"des"},[_vm._v(_vm._s(_vm.emergencyObj.enterprise_name && _vm.emergencyObj.enterprise_name.attributes.EnterpriseName)+"("+_vm._s(_vm.emergencyObj.accident_type)+")")])])]):_vm._e()])],1),_vm._v(" "),_c('yt-tabbar-panel',{attrs:{"text":"功能菜单","font":"iconfont icon-menu"}},[_c('yt-grid',{attrs:{"x":3,"y":5,"list":_vm.grids},scopedSlots:_vm._u([{key:"default",fn:function(data){return _c('yt-grid-item',_vm._b({on:{"click":function($event){return _vm.goPage(data.path)}}},'yt-grid-item',data,false))}}])})],1),_vm._v(" "),_c('yt-tabbar-panel',{attrs:{"text":"个人中心","font":"iconfont icon-person"}},[_c('yt-cell',{attrs:{"label":"头像"}},[_c('img',{staticClass:"avatar",attrs:{"src":_vm.user.avatar_path || __webpack_require__("NDmX")}})]),_vm._v(" "),_c('yt-cell',{attrs:{"label":"账户名称","value":_vm.user.username}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"联系方式","value":_vm.user.tel}}),_vm._v(" "),_c('yt-cell',{attrs:{"label":"当前版本","value":"已是最新版本"}}),_vm._v(" "),_c('yt-split'),_vm._v(" "),_c('yt-cell',{attrs:{"label":"修改个人资料","labelWidth":"70%","isLink":""},on:{"click":function($event){return _vm.goPage('/base/personal')}}}),_vm._v(" "),_c('yt-btn',{staticClass:"m-t",attrs:{"theme":"red"},on:{"click":_vm.logout}},[_vm._v("退出登录")])],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var apps_home = (esExports);
// CONCATENATED MODULE: ./src/apps/home/index.vue
function injectStyle (ssrContext) {
  __webpack_require__("rBH3")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-54312d87"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  home,
  apps_home,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var src_apps_home = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "pDSL":
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__.p + "static/img/slider-pic.acc5c65.png";

/***/ }),

/***/ "rBH3":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});